1. Field of Invention
The present invention relates generally to the field of extensible mark-up language (XML) schema validation. More specifically, the present invention is related to XML schema validation of XML document fragments.
2. Discussion of Prior Art
Extensible mark-up language (XML) schemas allow users to define complex structured XML data objects with strong typing, thus facilitating the widespread use of the XML language in data storage and data processing. As each XML document is offered, it must be validated against its XML schema definition to ensure validity prior to its usage. XML schema validation of XML document fragments plays a critical role in query languages, such as supporting the “IS VALID” operator in SQL/XML and the validate expression, and checking the validity of XML data constructed in XQuery. It is also the basis for incremental validation after document update—validating a document or fragment after an update without re-validating an entire XML document. This is performance critical especially when maintaining a large XML document or fragment.
A first existing technique for XML schema validation represents structural and type information from an XML schema in a tree format. In this approach, the parser receives an XML schema definition and the XML document as input, parses the XML document into a tree format, parses the XML schema definition into a schema tree format, and then traverses the XML document tree to check it against the XML schema tree. The same general-purpose schema validation parser is used for many different XML schemas. Although this technique is flexible in that it can validate against many different XML schemas, it is often slow, and sometimes requires traversal beginning at the root of a data tree.
A second existing technique is to generate XML schema validation parser code based on a particular XML schema definition. However, this approach is inflexible in that each XML schema validation parser can only validate against a particular XML schema. It is also necessary to point out that a parser generator approach generating custom validating parser code has difficulty meeting the requirements for fragment validation. To validate a fragment, it is necessary to find code or a routine entry corresponding to a schema component “to jump” or “call to” and to isolate such code from the validation parser code. These processes are not trivial. Alternatively, if one small validation parser were generated for each possible fragment, the number of the parsers would increase too rapidly to be implemented in practice.
Whatever the precise merits, features, and advantages of the above cited references, none of them achieves or fulfills the purposes of the present invention. Therefore, there is a need for an efficient and easily manageable approach to XML fragment validation.